﻿using SH;
using System;
using System.Collections.Generic;
using System.Text;

namespace MTS
{
    internal class mtDMSServer : mtInterface, ImtDMSServer
    {
    public    mtDMSServer()
       : base("mtDMSServer")
        {

        }


        shErrorCode ImtDMSServer.AimingRequest(string token, mtAimingRequest req)
        {
            MTSSerializer sc = new MTSSerializer();

            sc.serialize(req);

            var ec = __InvokeTwoWay(ImtSCSCallback._classID, ImtSCSCallback.SCSAimingRequest, token, ref sc);


            return ec;
        }

         shErrorCode ImtDMSServer.AutoDiagRequest(string token, mtAutoDiagRequest req, out mtAutoDiagResponse rsp)
        {
            MTSSerializer sc = new MTSSerializer();

            sc.serialize(req);

            var ec = __InvokeTwoWay(ImtSCSCallback._classID, ImtSCSCallback.SCSAutoDiagRequest, token, ref sc);

            if (ec != shErrorCode.sh_ec_Success)
            {
                rsp = null;

                return ec;
            }

            rsp = new mtAutoDiagResponse();

            sc.serialize(rsp);

            return ec;
        }

         shErrorCode ImtDMSServer.CalibRequest(string token, mtCalibRequest req, out mtCalibRespone rsp)
        {
            MTSSerializer sc = new MTSSerializer();

            sc.serialize(req);

            var ec = __InvokeTwoWay(ImtSCSCallback._classID, ImtSCSCallback.SCSCalibRequest, token, ref sc);

            if (ec != shErrorCode.sh_ec_Success)
            {
                rsp = null;

                return ec;
            }

            rsp = new mtCalibRespone();

            sc.serialize(rsp);

            return ec;
        }

         shErrorCode ImtDMSServer.DiagDetectorRequest(string token, mtDiagDetectorRequest req, out mtDiagDetectorResponse rsp)
        {
            MTSSerializer sc = new MTSSerializer();

            sc.serialize(req);

            var ec = __InvokeTwoWay(ImtSCSCallback._classID, ImtSCSCallback.SCSDiagDetectorRequest, token, ref sc);

            if (ec != shErrorCode.sh_ec_Success)
            {
                rsp = null;

                return ec;
            }

            rsp = new mtDiagDetectorResponse();

            sc.serialize(rsp);

            return ec;
        }

         shErrorCode ImtDMSServer.DiagProtectiveDoorRequest(string token, mtDiagProtectiveDoorRequest req, out mtDiagProtectiveDoorResponse rsp)
        {
            MTSSerializer sc = new MTSSerializer();

            sc.serialize(req);

            var ec = __InvokeTwoWay(ImtSCSCallback._classID, ImtSCSCallback.SCSDiagProtectiveDoorRequest, token, ref sc);

            if (ec != shErrorCode.sh_ec_Success)
            {
                rsp = null;

                return ec;
            }

            rsp = new mtDiagProtectiveDoorResponse();

            sc.serialize(rsp);

            return ec;
        }

         shErrorCode ImtDMSServer.DiagSourceRequest(string token, mtDiagSourceRequest req, out mtDiagSourceResponse rsp)
        {
            MTSSerializer sc = new MTSSerializer();

            sc.serialize(req);

            var ec = __InvokeTwoWay(ImtSCSCallback._classID, ImtSCSCallback.SCSDiagSourceRequest, token, ref sc);

            if (ec != shErrorCode.sh_ec_Success)
            {
                rsp = null;

                return ec;
            }

            rsp = new mtDiagSourceResponse();

            sc.serialize(rsp);

            return ec;
        }

         shErrorCode ImtDMSServer.DiagTransferTransportPlatformRequest(string token, DiagTransferTransportRequest req, out DiagTransferTransportResponse rsp)
        {
            MTSSerializer sc = new MTSSerializer();

            sc.serialize(req);

            var ec = __InvokeTwoWay(ImtSCSCallback._classID, ImtSCSCallback.SCSDiagTransferTransportPlatformRequest, token, ref sc);

            if (ec != shErrorCode.sh_ec_Success)
            {
                rsp = null;

                return ec;
            }

            rsp = new DiagTransferTransportResponse();

            sc.serialize(rsp);

            return ec;
        }

         shErrorCode ImtDMSServer.DiagVehicleRequest(string token, mtDiagVehicleRequest req, out mtDiagVehicleResponse rsp)
        {
            MTSSerializer sc = new MTSSerializer();

            sc.serialize(req);

            var ec = __InvokeTwoWay(ImtSCSCallback._classID, ImtSCSCallback.SCSDiagVehicleRequest, token, ref sc);

            if (ec != shErrorCode.sh_ec_Success)
            {
                rsp = null;

                return ec;
            }

            rsp = new mtDiagVehicleResponse();

            sc.serialize(rsp);

            return ec;
        }

        shErrorCode ImtDMSServer.GetDeviceOpInfo(string token, out mtDeviceOpInfo info)
        {
            MTSSerializer sc = new MTSSerializer();

            var ec = __InvokeTwoWay(ImtSCSCallback._classID, ImtSCSCallback.SCSDeviceOpInfo, token, ref sc);

            if (ec != shErrorCode.sh_ec_Success)
            {
                info = null;

                return ec;
            }

            info = new mtDeviceOpInfo();

            sc.serialize(info);

            return ec;
        }



     shErrorCode ImtDMSServer.MaintainRequest(string token, mtMaintainRequest req, out List<mtMaintainResponse> listRsp)
        {
            MTSSerializer sc = new MTSSerializer();

            sc.serialize(req);

            var ec = __InvokeTwoWay(ImtSCSCallback._classID, ImtSCSCallback.SCSMaintainRequest, token, ref sc);

            if (ec != shErrorCode.sh_ec_Success)
            {
                listRsp = null;

                return ec;
            }

            listRsp = new List<mtMaintainResponse>();

            sc.serialize(listRsp);

            return ec;
        }

     shErrorCode ImtDMSServer.NotifyCargoInfo(string token, mtCargoCountInfo info)
        {
            MTSSerializer sc = new MTSSerializer();

            sc.serialize(info);

            var ec = __InvokeOneWay(ImtSCSCallback._classID, ImtSCSCallback.SCSCargoCount, token, sc);

            return ec;
        }

     shErrorCode ImtDMSServer.ResetCmd(string token, mtResetCmdInfo info)
        {
            MTSSerializer sc = new MTSSerializer();

            sc.serialize(info);

            var ec = __InvokeTwoWay(ImtSCSCallback._classID, ImtSCSCallback.SCSResetCmd, token, ref sc);

            return ec;
        }

     shErrorCode ImtDMSServer.SaveRawOriData(string token, mtSaveRawOriData data)
        {
            MTSSerializer sc = new MTSSerializer();

            sc.serialize(data);

            var ec = __InvokeTwoWay(ImtSCSCallback._classID, ImtSCSCallback.SCSSaveRawOriData, token, ref sc);

            return ec;
        }

     shErrorCode ImtDMSServer.SceneRequest(string token, mtSceneRequest req, out mtSceneResponse rsp)
        {
            MTSSerializer sc = new MTSSerializer();

            sc.serialize(req);

            var ec = __InvokeTwoWay(ImtSCSCallback._classID, ImtSCSCallback.SCSSceneRequest, token, ref sc);

            if (ec != shErrorCode.sh_ec_Success)
            {
                rsp = null;

                return ec;
            }

            rsp = new mtSceneResponse();

            sc.serialize(rsp);

            return ec;
        }

    }
}
